import java.util.Arrays;

/**
 * @author kyang
 */
public class Levels {

    private static final int[][] LEVEL1 = {
            {0, 0, 0, 0, 1, 1, 1, 0, 0, 0},
            {0, 0, 0, 0, 1, 5, 1, 0, 0, 0},
            {0, 0, 0, 0, 1, 4, 1, 0, 0, 0},
            {1, 1, 1, 1, 1, 4, 1, 0, 0, 0},
            {1, 5, 4, 4, 3, 3, 1, 1, 1, 1},
            {1, 1, 1, 1, 3, 2, 3, 4, 5, 1},
            {0, 0, 0, 1, 4, 1, 1, 1, 1, 1},
            {0, 0, 0, 1, 4, 1, 0, 0, 0, 0},
            {0, 0, 0, 1, 5, 1, 0, 0, 0, 0},
            {0, 0, 0, 1, 1, 1, 0, 0, 0, 0}
    };
    private static final int[][] LEVEL2 = {
            {1, 1, 1, 1, 1, 0, 0, 0, 0, 0},
            {1, 2, 4, 4, 1, 0, 0, 0, 0, 0},
            {1, 4, 3, 3, 1, 0, 1, 1, 1, 0},
            {1, 4, 3, 4, 1, 0, 1, 5, 1, 0},
            {1, 1, 1, 4, 1, 1, 1, 5, 1, 0},
            {0, 1, 1, 4, 4, 4, 4, 5, 1, 0},
            {0, 1, 4, 4, 4, 1, 4, 4, 1, 0},
            {0, 1, 4, 4, 4, 1, 1, 1, 1, 0},
            {0, 1, 1, 1, 1, 1, 0, 0, 0, 0}
    };
    private static final int[][] LEVEL3 = {
            {1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
            {1, 2, 4, 4, 1, 1, 4, 4, 4, 1},
            {1, 4, 3, 4, 1, 1, 4, 3, 4, 1},
            {1, 4, 3, 5, 5, 4, 5, 3, 4, 1},
            {1, 4, 4, 4, 4, 4, 5, 4, 4, 1},
            {1, 4, 4, 5, 4, 4, 4, 4, 4, 1},
            {1, 4, 3, 5, 4, 5, 5, 3, 4, 1},
            {1, 4, 3, 4, 1, 1, 4, 3, 4, 1},
            {1, 4, 4, 4, 1, 1, 4, 4, 4, 1},
            {1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
    };
    private static final int[][] LEVEL4 = {
            {1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
            {1, 4, 4, 4, 4, 4, 4, 4, 4, 1},
            {1, 4, 5, 5, 1, 3, 4, 4, 4, 1},
            {1, 4, 5, 5, 4, 3, 4, 4, 4, 1},
            {1, 4, 3, 4, 4, 4, 4, 4, 4, 1},
            {1, 4, 3, 4, 2, 4, 4, 4, 4, 1},
            {1, 4, 4, 4, 4, 4, 4, 4, 4, 1},
            {1, 4, 4, 4, 4, 4, 4, 4, 4, 1},
            {1, 4, 4, 4, 4, 4, 4, 4, 4, 1},
            {1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
    };
    private static final int[][] LEVEL5 = {
            {1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
            {1, 4, 4, 4, 4, 1, 4, 4, 4, 1},
            {1, 4, 3, 3, 4, 1, 4, 2, 4, 1},
            {1, 4, 4, 3, 4, 1, 4, 4, 4, 1},
            {1, 4, 4, 4, 4, 4, 4, 4, 4, 1},
            {1, 5, 5, 1, 4, 3, 3, 4, 1, 1},
            {1, 5, 5, 1, 4, 4, 3, 4, 1, 1},
            {1, 5, 5, 1, 4, 4, 4, 4, 4, 1},
            {1, 4, 4, 4, 4, 4, 4, 4, 4, 1},
            {1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
    };

    public static int[][] getLevel(int n) {
        int[][] original = switch (n) {
            case 1 -> LEVEL1;
            case 2 -> LEVEL2;
            case 3 -> LEVEL3;
            case 4 -> LEVEL4;
            case 5 -> LEVEL5;
            default -> throw new IllegalStateException("Unexpected value: " + n);
        };
        return deepCopyLevel(original);
    }

    private static int[][] deepCopyLevel(int[][] original) {
        int[][] copy = new int[original.length][];
        for (int i = 0; i < original.length; i++) {
            copy[i] = Arrays.copyOf(original[i], original[i].length);
        }
        return copy;
    }
}
